package com.whisper.application.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.whisper.common.annotation.Log;
import com.whisper.common.annotation.PageQuery;
import com.whisper.common.core.controller.BaseController;
import com.whisper.common.enums.BusinessType;
import com.whisper.application.service.domain.VrApply;
import com.whisper.application.service.service.IVrApplyService;
import com.whisper.common.excel.utils.poi.ExcelUtil;

/**
 * 用户活动申请Controller
 * 
 * @author whisper
 * @date 2024-01-07
 */
@RestController
@RequestMapping("/service/apply")
public class VrApplyController extends BaseController
{
    @Autowired
    private IVrApplyService vrApplyService;

    /**
     * 查询用户活动申请列表
     */
    @PageQuery
    @PreAuthorize("@ss.hasPermi('service:apply:list')")
    @GetMapping("/list")
    public List<VrApply> list(VrApply vrApply)
    {
        return vrApplyService.selectVrApplyList(vrApply);
    }

    /**
     * 导出用户活动申请列表
     */
    @PreAuthorize("@ss.hasPermi('service:apply:export')")
    @Log(title = "用户活动申请", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VrApply vrApply)
    {
        List<VrApply> list = vrApplyService.selectVrApplyList(vrApply);
        ExcelUtil<VrApply> util = new ExcelUtil<VrApply>(VrApply.class);
        util.exportExcel(response, list, "用户活动申请数据");
    }

    /**
     * 获取用户活动申请详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:apply:query')")
    @GetMapping(value = "/{id}")
    public VrApply getInfo(@PathVariable("id") Long id)
    {
        return vrApplyService.selectVrApplyById(id);
    }

    /**
     * 新增用户活动申请
     */
    @PreAuthorize("@ss.hasPermi('service:apply:add')")
    @Log(title = "用户活动申请", businessType = BusinessType.INSERT)
    @PostMapping
    public void add(@RequestBody VrApply vrApply)
    {
        vrApplyService.insertVrApply(vrApply);
    }

    /**
     * 修改用户活动申请
     */
    @PreAuthorize("@ss.hasPermi('service:apply:edit')")
    @Log(title = "用户活动申请", businessType = BusinessType.UPDATE)
    @PutMapping
    public void edit(@RequestBody VrApply vrApply)
    {
        vrApplyService.updateVrApply(vrApply);
    }

    /**
     * 删除用户活动申请
     */
    @PreAuthorize("@ss.hasPermi('service:apply:remove')")
    @Log(title = "用户活动申请", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public void remove(@PathVariable Long[] ids)
    {
        vrApplyService.deleteVrApplyByIds(ids);
    }
}
